package test;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public class mian {

	/** 
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Runnable r = new Runnable() {
				URL url = new URL("http://172.18.27.192:8052/DsmGov_ESCO/");
				
				HttpURLConnection urlc = new HttpURLConnection(url) {
					@Override
					public void connect() throws IOException {
						System.out.println("connect");
					}
					@Override
					public boolean usingProxy() {
						return false;
					}
					@Override
					public void disconnect() {
						System.out.println("disconnect");
						
					}
				};
				
				
				@Override
				public void run() {
					try {
						urlc.connect();
					} catch (IOException e1) {
						e1.printStackTrace();
					}
					while(1==1)
					{
						try {
								try {
									urlc.connect();
								} catch (IOException e1) {
									e1.printStackTrace();
								}
							Thread.sleep(5000);
							System.out.println("sleep 5  秒。。。。。");
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
					}
					
				}
			};

			
			Thread t = new Thread(r);
			t.start();
			
			//Socket socket =  Socket("172.18.27.192",8022);
			//System.out.println(socket.isConnected());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

